package com.xiaocg.spring.tx;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class UserDaoImpl implements UserDao{

    @Autowired
    @Qualifier("jdbcTemplate")
    private JdbcTemplate jdbcTemplate;


    @Override
    public int updateUser(Long id, Integer account) {
        String sql = "update user set account=? where id=? ";
        return jdbcTemplate.update(sql,account,id);
    }

    @Override
    public int updateBook(Long id, Integer num) {
        String sql = "update book set num=? where id=? ";
        return jdbcTemplate.update(sql,num,id);
    }


}
